//
// Copyright (C) 2011 - 2013  Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1
//#include "stdafx.h"
#include "LogCubicInterpolation.h"
using namespace Cephei::QL::Math::Interpolations;
#include <gen/QL/Math/Interpolation.h>
using namespace Cephei::QL::Math;
#undef HANDLE
#undef ABSTRACT
#undef STRUCT
Cephei::QL::Math::Interpolations::CLogCubicInterpolation::CLogCubicInterpolation (boost::shared_ptr<QuantLib::LogCubicInterpolation>& childNative, Object^ owner) : CInterpolation(CLogCubicInterpolation::typeid)
{
#ifdef HANDLE
	_phLogCubicInterpolation = NULL;
#endif
	_ppLogCubicInterpolation = &childNative;
    _ppInterpolation = new boost::shared_ptr<QuantLib::Interpolation> (boost::dynamic_pointer_cast<QuantLib::Interpolation> (*_ppLogCubicInterpolation));
}
Cephei::QL::Math::Interpolations::CLogCubicInterpolation::CLogCubicInterpolation (QuantLib::LogCubicInterpolation& childNative, Object^ owner) : CInterpolation(CLogCubicInterpolation::typeid)
{
#ifdef HANDLE
	_phLogCubicInterpolation = NULL;
#endif
	_ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (&childNative);
    _ppInterpolation = new boost::shared_ptr<QuantLib::Interpolation> (boost::dynamic_pointer_cast<QuantLib::Interpolation> (*_ppLogCubicInterpolation));
    _LogCubicInterpolationOwner = owner;
    _InterpolationOwner = owner;
}

Cephei::QL::Math::Interpolations::CLogCubicInterpolation::CLogCubicInterpolation (CLogCubicInterpolation^ copy) : CInterpolation(CLogCubicInterpolation::typeid)
{
#ifdef HANDLE
	_phLogCubicInterpolation = NULL;
#endif
	if (copy->HasNative() != NULL)
    {
		_ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (copy->GetShared());
        _ppInterpolation = new boost::shared_ptr<QuantLib::Interpolation> (boost::dynamic_pointer_cast<QuantLib::Interpolation> (*_ppLogCubicInterpolation));
    }
}
Cephei::QL::Math::Interpolations::CLogCubicInterpolation::CLogCubicInterpolation (PLATFORM::Type^ t) : CInterpolation(CLogCubicInterpolation::typeid)
{
#ifdef HANDLE
	_phLogCubicInterpolation = NULL;
#endif
	if (!t->IsSubclassOf(CLogCubicInterpolation::typeid))
		throw REFNEW Exception ("Invalid base-case init");
}
#ifdef HANDLE
Cephei::QL::Math::Interpolations::CLogCubicInterpolation::CLogCubicInterpolation (QuantLib::Handle<QuantLib::LogCubicInterpolation>& childNative, Object^ owner)  : CInterpolation(CLogCubicInterpolation::typeid)
{
	_phLogCubicInterpolation = &childNative;
	_ppLogCubicInterpolation = &static_cast<boost::shared_ptr<QuantLib::LogCubicInterpolation>>(childNative.currentLink());
    _ppInterpolation = new boost::shared_ptr<QuantLib::Interpolation> (boost::dynamic_pointer_cast<QuantLib::Interpolation> (*_ppLogCubicInterpolation));
    _LogCubicInterpolationOwner = owner;
}
Cephei::QL::Math::Interpolations::CLogCubicInterpolation::CLogCubicInterpolation (QuantLib::Handle<QuantLib::LogCubicInterpolation> childNative)  : CInterpolation(CLogCubicInterpolation::typeid)
{
	_phLogCubicInterpolation = &childNative;
	_ppLogCubicInterpolation = &static_cast<boost::shared_ptr<QuantLib::LogCubicInterpolation>>(childNative.currentLink());
    _ppInterpolation = new boost::shared_ptr<QuantLib::Interpolation> (boost::dynamic_pointer_cast<QuantLib::Interpolation> (*_ppLogCubicInterpolation));
}
#endif
#ifdef STRUCT
Cephei::QL::Math::Interpolations::CLogCubicInterpolation::CLogCubicInterpolation (QuantLib::LogCubicInterpolation childNative)  : CInterpolation(CLogCubicInterpolation::typeid)
{
#ifdef HANDLE
	_phLogCubicInterpolation = NULL;
#endif
	_ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (new QuantLib::LogCubicInterpolation (childNative));
    _ppInterpolation = new boost::shared_ptr<QuantLib::Interpolation> (boost::dynamic_pointer_cast<QuantLib::Interpolation> (*_ppLogCubicInterpolation));
}
#endif

Cephei::QL::Math::Interpolations::CLogCubicInterpolation::~CLogCubicInterpolation ()
{
    if (_ppLogCubicInterpolation != NULL)
    {
	    delete _ppLogCubicInterpolation;
        _ppLogCubicInterpolation = NULL;
    }
}
Cephei::QL::Math::Interpolations::CLogCubicInterpolation::!CLogCubicInterpolation ()
{
    if (_ppLogCubicInterpolation != NULL)
    {
	    delete _ppLogCubicInterpolation;
    }
}
QuantLib::LogCubicInterpolation& Cephei::QL::Math::Interpolations::CLogCubicInterpolation::GetReference ()
{
    if (_ppLogCubicInterpolation == NULL) throw REFNEW NativeNullException ();
	return **_ppLogCubicInterpolation;
}
boost::shared_ptr<QuantLib::LogCubicInterpolation>& Cephei::QL::Math::Interpolations::CLogCubicInterpolation::GetShared ()
{
    if (_ppLogCubicInterpolation == NULL) throw REFNEW NativeNullException ();
	return *_ppLogCubicInterpolation;
}
QuantLib::LogCubicInterpolation* Cephei::QL::Math::Interpolations::CLogCubicInterpolation::GetPointer ()
{
    if (_ppLogCubicInterpolation == NULL) throw REFNEW NativeNullException ();
	return &**_ppLogCubicInterpolation;
}
#ifdef HANDLE
QuantLib::Handle<QuantLib::LogCubicInterpolation>& Cephei::QL::Math::Interpolations::CLogCubicInterpolation::GetHandle ()
{
	if (_phLogCubicInterpolation == NULL)
	{
		_phLogCubicInterpolation = new Handle<QuantLib::LogCubicInterpolation> (*_ppLogCubicInterpolation);
	}
	return *_phLogCubicInterpolation;
}
#endif
bool Cephei::QL::Math::Interpolations::CLogCubicInterpolation::HasNative () 
{
	return (_ppLogCubicInterpolation != NULL);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Factory class

